import React, { Component } from 'react'
//ref 回调函数的表示方式
export default class App extends Component {
  render() {
    return (
      <div>
        <input type="text" ref={(el) => {this.input = el}} /><button onClick={this.show}>显示</button>
        <hr />
        <div ref={el => this.box = el} style={{width: '400px',height: '300px', border: 'solid 2px #520'}}></div>
      </div>
    )
  }

  show = (e) => {
    //获取input的值
    let v = this.input.value;
    //设置标签文本
    this.box.innerHTML = v;
  }

}

